package com.bwie.controller;

import com.bwie.pojo.TbType;
import com.bwie.service.TbTypeService;
import com.bwie.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/6/23 13:38
 * @Description:
 **/
@RestController
@RequestMapping("/shop/type")
public class TypeController {
    @Autowired
     TbTypeService tbTypeService;

    /**
     * 类型类表
     * @return
     */
    @PostMapping("/TypetreeList")
    public R TypetreeList(){
        return tbTypeService.TypetreeList();
    }

    /**
     * 类型类表
     * @return
     */
    @PostMapping("/SelecttreeList")
    public R SelecttreeList(){
        return tbTypeService.SelecttreeList();
    }

    /**
     * 添加类型
     * @param type
     * @return
     */
    @PostMapping("/addType")
    public R addType(@RequestBody TbType type){
        return tbTypeService.addType(type);
    }

    /**
     * 上传文件
     * @param file
     * @return
     */
    @PostMapping("/uploadImage")
    public R uploadImage(@RequestPart("file") MultipartFile file){
        return tbTypeService.uploadImage(file);
    }

    /**
     * 修改类型
     * @param type
     * @return
     */
    @PostMapping("/updateType")
    public R updateType(@RequestBody TbType type){
        return tbTypeService.updateType(type);
    }


}
